-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add per user metrics to mysql input #6132
Conversation
Pull request was opened one year ago, and no any single comment :( |
plugins/inputs/mysql/mysql.go
Outdated
// gatherPerfSummaryPerAccountPerEvent can be used to fetch enabled metrics from | ||
// performance_schema.events_statements_summary_by_account_by_event_name | ||
func (m *Mysql) gatherPerfSummaryPerAccountPerEvent(db *sql.DB, serv string, acc telegraf.Accumulator) error { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove newline to match style of other gather functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @AlexKapustin! I totally agree that this is killing motivation and I want to apologize for this taking so long. InfluxData is trying to improve and here I am.. ;-P
I have some comments in the code. The most striking one is that I think the code breaks when limiting the number of collected events using the perf_summary_events
option. Could you please take a look!? I promise it will not take another year to get this in, given we can work out the issues. :-/
Hello, @srebhan ! Thank you very much for your response :) |
# Conflicts: # plugins/inputs/mysql/mysql.go
plugins/inputs/mysql/mysql.go
Outdated
@@ -121,6 +123,13 @@ const sampleConfig = ` | |||
# perf_events_statements_limit = 250 | |||
# perf_events_statements_time_limit = 86400 | |||
|
|||
## gather metrics from PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME | |||
gather_perf_sum_per_acc_per_event = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing this: Please comment the lines containing default values!
plugins/inputs/mysql/mysql.go
Outdated
|
||
## list of events to be gathered for gather_perf_sum_per_acc_per_event | ||
## in case of empty list all events will be gathered | ||
perf_summary_events = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, comment that line as it contains the default.
It's done! Thank you for your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change could also use some tests. The mysql plugin in general doesn't have much test coverage. We could mock the result of a query and make sure the output metric is as expected. Even an integration test that requires mysql to be running would be useful.
keep sample config consistent Co-authored-by: reimda <[email protected]>
@AlexKapustin could you look into the unit tests @reimda suggested!? |
Yes, I will have a look today. Thank you for remind me :) |
I had have a look, and basically saying, mysql plugin doesn't have tests at all, only connections and one integration test! |
Hi @AlexKapustin, thanks for being so responsive even though it took us so long to get to this PR. It would be great if you could write tests in this PR that cover the new functionality in this PR. If this will require setting up a lot of common infrastructure and you would like to do it in a separate PR that's ok too. Whatever you prefer. I went ahead and made a new issue about the mysql missing tests (#8561). If you would like to write the missing tests for the existing functionality it would be very appreciated! |
Thanks @AlexKapustin for clarification. I think we can merge this one as the code looks fine... As @reimda said, tests are appreciated and I promise it won't take another year to review them. ;-) |
(cherry picked from commit 21253ec)
closes #6131
Required for all PRs: